package com.tgy.admin.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.tgy.admin.Service.MenuService;
import com.tgy.vo.MenuVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author tianguiyin
 * @version 1.0
 * @date 2022/6/20 15:50
 */
@Validated
@Api(value = "菜单、权限控制器", tags = {"菜单管理"})
@RestController
@RequestMapping("/admin/menu")
public class MenuController {

    @Resource
    private MenuService menuService;

    /**
     * 获取登陆人的菜单、角色、权限
     */
    @ApiOperation("获取登陆人的菜单、角色、权限")
    @SaCheckPermission
    @GetMapping("getMenuAndRoleAndPermission")
    public void getMenuAndRoleAndPermission(){
        menuService.getMenuAndRoleAndPermission("");
    }


    @ApiOperation("获取当前登录用户的菜单")
    @SaCheckPermission
    @GetMapping("getMenu")
    public List<MenuVo> getMenu(){
        return menuService.getMenu();
    }

    @ApiOperation("获取当前登录用户的角色")
    @SaCheckPermission
    @GetMapping("getRole")
    public List<String> getRole(){
        return menuService.getRole();
    }
    
    @ApiOperation("获取当前登录用户的权限")
    @SaCheckPermission
    @GetMapping("getPermission")
    public List<String> getPermission(){
        return menuService.getPermission();
    }

}
